<template>
	<view class="container">
		<view class="myjf_top">
			<view class="myjf_tnum">当前积分：<text>{{user.jifen}}</text></view>
			<image src="../../../static/images/myjf_ico.png"></image>
		</view>
		<view class="jfcontent">
			<view class="jftitle"><text>积分明细</text></view>
			<block v-if="list.length!==0">
				<view class="jflist">
					<block v-for="i in list" :key="i.id">
						<view class="dl" :class="i.point<0 ? 'on':''">
							<view class="dt">
								<view class="title">{{i.name}}</view>
								<view class="time">{{i.time}}</view>
							</view>
							<view class="dd">
								<block v-if="i.point>0">+</block>
								<block v-if="i.point<0"></block>{{i.point}}
							</view>
						</view>
					</block>
				</view>
			</block>
			<block v-else>
				<div class="empty_txt">暂无信息</div>
			</block>
		</view>
	</view>
</template>

<script>
	import API from "@/common/api.js";
	export default {
		data() {
			return {
				user: [],
				list: [],

			}
		},
		onLoad(options) {
			var $this = this
			API.post("user/getUser").then((res) => {
				if (res.code == 1) {
					$this.user = res.data
				}
			})
			API.post("product/logs").then((res) => {
				if (res.code == 1) {
					$this.list = res.data
				}
			})
		},
		methods: {

		}
	}
</script>

<style lang="scss">
	page {
		background: #f7f7f7;
	}

	.container {
		padding-bottom: 30rpx;
	}

	.container::after {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		width: 100%;
		height: 780rpx;
		background: linear-gradient(to bottom, #3c8ffb, rgba(60, 143, 251, 0));
	}

	.myjf_top {
		position: relative;
		z-index: 2;
		padding: 60rpx 60rpx 40rpx;
	}

	.myjf_tnum {
		color: #fff;
		font-size: 30rpx;
		font-weight: bold;
	}

	.myjf_tnum text {
		font-size: 52rpx;
	}

	.myjf_top image {
		width: 230rpx;
		height: 204rpx;
		position: absolute;
		top: 40rpx;
		right: 50rpx;
	}

	.jfcontent {
		margin: 0 30rpx;
		background: #fff;
		border-radius: 20rpx;
		padding: 30rpx;
		background: #fff;
		position: relative;
		z-index: 1;
	}

	.jftitle {
		text-align: center;
		padding: 30rpx 0;
		font-size: 36rpx;
		font-weight: bold;
		line-height: 42rpx;
	}

	.jftitle text {
		position: relative;
		display: inline-block;
		padding: 0 6rpx;
	}

	.jftitle text::after {
		content: '';
		width: 100%;
		height: 10rpx;
		border-radius: 10rpx;
		background: #8fe2fe;
		position: absolute;
		left: 0;
		bottom: 0;
		z-index: -1;
	}

	.jflist {
		width: 100%;
	}

	.jflist .dl {
		border-bottom: 2rpx #eee solid;
		padding: 28rpx 0;
		display: flex;
		justify-content: space-between;
	}

	.jflist .dl:last-child {
		border-bottom-width: 0;
	}

	.jflist .dt {
		flex: 1;
	}

	.jflist .title {
		font-size: 30rpx;
		font-weight: bold;
	}

	.jflist .time {
		color: #888;
		margin-top: 10rpx;
	}

	.jflist .dd {
		font-size: 36rpx;
		font-weight: bold;
		color: #f47f00;
	}

	.jflist .dl.on .dd {
		color: #357dff;
	}

	.empty_txt {
		text-align: center;
		color: #888;
		padding: 30rpx 0;
	}
</style>